/*     */ package com.zimbra.cs.mailbox.calendar;
/*     */ 
/*     */ import com.zimbra.common.calendar.CalendarUtil;
/*     */ import com.zimbra.common.calendar.ZCalendar.ICalTok;
/*     */ import com.zimbra.common.calendar.ZCalendar.ZParameter;
/*     */ import com.zimbra.common.calendar.ZCalendar.ZProperty;
/*     */ import com.zimbra.common.service.ServiceException;
/*     */ import com.zimbra.common.soap.Element;
/*     */ import com.zimbra.cs.account.IDNUtil;
/*     */ import com.zimbra.cs.mailbox.Metadata;
/*     */ import com.zimbra.cs.service.mail.ToXML;
/*     */ import com.zimbra.soap.mail.type.CalOrganizer;
/*     */ import java.util.List;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class ZOrganizer
/*     */   extends CalendarUser
/*     */ {
/*     */   public ZOrganizer(String address, String cn)
/*     */   {
/*  36 */     super(address, cn, null, null, null);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public ZOrganizer(String address, String cn, String sentBy, String dir, String language, List<ZCalendar.ZParameter> xparams)
/*     */   {
/*  45 */     super(address, cn, sentBy, dir, language, xparams);
/*     */   }
/*     */   
/*     */   public ZOrganizer(ZOrganizer other) {
/*  49 */     super(other);
/*     */   }
/*     */   
/*     */   public ZOrganizer(ZCalendar.ZProperty prop) {
/*  53 */     super(prop);
/*     */   }
/*     */   
/*     */   public ZOrganizer(Metadata meta) throws ServiceException {
/*  57 */     super(meta);
/*     */   }
/*     */   
/*     */   protected ZCalendar.ICalTok getPropertyName() {
/*  61 */     return ZCalendar.ICalTok.ORGANIZER;
/*     */   }
/*     */   
/*     */ 
/*     */   public CalOrganizer toJaxb()
/*     */   {
/*  67 */     CalOrganizer org = new CalOrganizer();
/*  68 */     String str = getAddress();
/*  69 */     org.setAddress(IDNUtil.toUnicode(str));
/*  70 */     org.setUrl(str);
/*  71 */     if (hasCn())
/*  72 */       org.setDisplayName(getCn());
/*  73 */     if (hasSentBy())
/*  74 */       org.setSentBy(getSentBy());
/*  75 */     if (hasDir())
/*  76 */       org.setDir(getDir());
/*  77 */     if (hasLanguage())
/*  78 */       org.setLanguage(getLanguage());
/*  79 */     org.setXParams(ToXML.jaxbXParams(xparamsIterator()));
/*  80 */     return org;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Element toXml(Element parent)
/*     */   {
/*  91 */     Element orgElt = parent.addUniqueElement("or");
/*  92 */     String str = getAddress();
/*  93 */     orgElt.addAttribute("a", IDNUtil.toUnicode(str));
/*  94 */     orgElt.addAttribute("url", str);
/*  95 */     if (hasCn())
/*  96 */       orgElt.addAttribute("d", getCn());
/*  97 */     if (hasSentBy())
/*  98 */       orgElt.addAttribute("sentBy", getSentBy());
/*  99 */     if (hasDir())
/* 100 */       orgElt.addAttribute("dir", getDir());
/* 101 */     if (hasLanguage()) {
/* 102 */       orgElt.addAttribute("lang", getLanguage());
/*     */     }
/* 104 */     CalendarUtil.encodeXParams(orgElt, xparamsIterator());
/*     */     
/* 106 */     return orgElt;
/*     */   }
/*     */   
/*     */   public static ZOrganizer parse(Element element) throws ServiceException {
/* 110 */     String address = IDNUtil.toAscii(element.getAttribute("a", null));
/* 111 */     if (address == null) {
/* 112 */       address = element.getAttribute("url", null);
/* 113 */       if (address == null) {
/* 114 */         throw ServiceException.INVALID_REQUEST("missing organizer address", null);
/*     */       }
/*     */     }
/*     */     
/* 118 */     String cn = element.getAttribute("d", null);
/* 119 */     String sentBy = element.getAttribute("sentBy", null);
/* 120 */     String dir = element.getAttribute("dir", null);
/* 121 */     String lang = element.getAttribute("lang", null);
/*     */     
/* 123 */     List<ZCalendar.ZParameter> xparams = CalendarUtil.parseXParams(element);
/*     */     
/* 125 */     ZOrganizer org = new ZOrganizer(address, cn, sentBy, dir, lang, xparams);
/* 126 */     return org;
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mailbox/calendar/ZOrganizer.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */